import express from "express";
import {tree_model} from "../db/system/base_set.js";

const router = express.Router();

router.get('/', (req, res) => {
    res.send('服务器主页面')
})

router.get('/tree_data', async (req, res) => {
    const {search_key} = req.query
    const query = {}
    if (search_key) {
        query.name = {$regex: search_key, $options: 'i'}
    }
    const data = await tree_model.find(query)
    res.send({data})
})

export default router;
